// Generated from RuleSet.g4 by ANTLR 4.9
        //一种action,定义生成的词法语法解析文件的头，当使用java的时候，生成的类需要包名，可以在这里统一定义
 package com.taotao.antlr4.sql;
 
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.misc.*;
import org.antlr.v4.runtime.tree.*;
import java.util.List;
import java.util.Iterator;
import java.util.ArrayList;

@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class RuleSetParser extends Parser {
	static { RuntimeMetaData.checkVersion("4.9", RuntimeMetaData.VERSION); }

	protected static final DFA[] _decisionToDFA;
	protected static final PredictionContextCache _sharedContextCache =
		new PredictionContextCache();
	public static final int
		WS=1, ADD=2, SUB=3, MUL=4, DIV=5, NUMBER=6;
	public static final int
		RULE_calcu = 0;
	private static String[] makeRuleNames() {
		return new String[] {
			"calcu"
		};
	}
	public static final String[] ruleNames = makeRuleNames();

	private static String[] makeLiteralNames() {
		return new String[] {
			null, null, "'+'", "'-'", "'*'", "'/'"
		};
	}
	private static final String[] _LITERAL_NAMES = makeLiteralNames();
	private static String[] makeSymbolicNames() {
		return new String[] {
			null, "WS", "ADD", "SUB", "MUL", "DIV", "NUMBER"
		};
	}
	private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
	public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);

	/**
	 * @deprecated Use {@link #VOCABULARY} instead.
	 */
	@Deprecated
	public static final String[] tokenNames;
	static {
		tokenNames = new String[_SYMBOLIC_NAMES.length];
		for (int i = 0; i < tokenNames.length; i++) {
			tokenNames[i] = VOCABULARY.getLiteralName(i);
			if (tokenNames[i] == null) {
				tokenNames[i] = VOCABULARY.getSymbolicName(i);
			}

			if (tokenNames[i] == null) {
				tokenNames[i] = "<INVALID>";
			}
		}
	}

	@Override
	@Deprecated
	public String[] getTokenNames() {
		return tokenNames;
	}

	@Override

	public Vocabulary getVocabulary() {
		return VOCABULARY;
	}

	@Override
	public String getGrammarFileName() { return "RuleSet.g4"; }

	@Override
	public String[] getRuleNames() { return ruleNames; }

	@Override
	public String getSerializedATN() { return _serializedATN; }

	@Override
	public ATN getATN() { return _ATN; }

	public RuleSetParser(TokenStream input) {
		super(input);
		_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
	}

	public static class CalcuContext extends ParserRuleContext {
		public CalcuContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_calcu; }
	 
		public CalcuContext() { }
		public void copyFrom(CalcuContext ctx) {
			super.copyFrom(ctx);
		}
	}
	public static class DivContext extends CalcuContext {
		public List<TerminalNode> NUMBER() { return getTokens(RuleSetParser.NUMBER); }
		public TerminalNode NUMBER(int i) {
			return getToken(RuleSetParser.NUMBER, i);
		}
		public TerminalNode DIV() { return getToken(RuleSetParser.DIV, 0); }
		public DivContext(CalcuContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof RuleSetListener ) ((RuleSetListener)listener).enterDiv(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof RuleSetListener ) ((RuleSetListener)listener).exitDiv(this);
		}
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof RuleSetVisitor ) return ((RuleSetVisitor<? extends T>)visitor).visitDiv(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class AddContext extends CalcuContext {
		public List<TerminalNode> NUMBER() { return getTokens(RuleSetParser.NUMBER); }
		public TerminalNode NUMBER(int i) {
			return getToken(RuleSetParser.NUMBER, i);
		}
		public TerminalNode ADD() { return getToken(RuleSetParser.ADD, 0); }
		public AddContext(CalcuContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof RuleSetListener ) ((RuleSetListener)listener).enterAdd(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof RuleSetListener ) ((RuleSetListener)listener).exitAdd(this);
		}
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof RuleSetVisitor ) return ((RuleSetVisitor<? extends T>)visitor).visitAdd(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class SubContext extends CalcuContext {
		public List<TerminalNode> NUMBER() { return getTokens(RuleSetParser.NUMBER); }
		public TerminalNode NUMBER(int i) {
			return getToken(RuleSetParser.NUMBER, i);
		}
		public TerminalNode SUB() { return getToken(RuleSetParser.SUB, 0); }
		public SubContext(CalcuContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof RuleSetListener ) ((RuleSetListener)listener).enterSub(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof RuleSetListener ) ((RuleSetListener)listener).exitSub(this);
		}
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof RuleSetVisitor ) return ((RuleSetVisitor<? extends T>)visitor).visitSub(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class MulContext extends CalcuContext {
		public List<TerminalNode> NUMBER() { return getTokens(RuleSetParser.NUMBER); }
		public TerminalNode NUMBER(int i) {
			return getToken(RuleSetParser.NUMBER, i);
		}
		public TerminalNode MUL() { return getToken(RuleSetParser.MUL, 0); }
		public MulContext(CalcuContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof RuleSetListener ) ((RuleSetListener)listener).enterMul(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof RuleSetListener ) ((RuleSetListener)listener).exitMul(this);
		}
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof RuleSetVisitor ) return ((RuleSetVisitor<? extends T>)visitor).visitMul(this);
			else return visitor.visitChildren(this);
		}
	}

	public final CalcuContext calcu() throws RecognitionException {
		CalcuContext _localctx = new CalcuContext(_ctx, getState());
		enterRule(_localctx, 0, RULE_calcu);
		try {
			setState(14);
			_errHandler.sync(this);
			switch ( getInterpreter().adaptivePredict(_input,0,_ctx) ) {
			case 1:
				_localctx = new MulContext(_localctx);
				enterOuterAlt(_localctx, 1);
				{
				setState(2);
				match(NUMBER);
				setState(3);
				match(MUL);
				setState(4);
				match(NUMBER);
				}
				break;
			case 2:
				_localctx = new DivContext(_localctx);
				enterOuterAlt(_localctx, 2);
				{
				setState(5);
				match(NUMBER);
				setState(6);
				match(DIV);
				setState(7);
				match(NUMBER);
				}
				break;
			case 3:
				_localctx = new AddContext(_localctx);
				enterOuterAlt(_localctx, 3);
				{
				setState(8);
				match(NUMBER);
				setState(9);
				match(ADD);
				setState(10);
				match(NUMBER);
				}
				break;
			case 4:
				_localctx = new SubContext(_localctx);
				enterOuterAlt(_localctx, 4);
				{
				setState(11);
				match(NUMBER);
				setState(12);
				match(SUB);
				setState(13);
				match(NUMBER);
				}
				break;
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static final String _serializedATN =
		"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\b\23\4\2\t\2\3\2"+
		"\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\5\2\21\n\2\3\2\2\2\3\2\2"+
		"\2\2\24\2\20\3\2\2\2\4\5\7\b\2\2\5\6\7\6\2\2\6\21\7\b\2\2\7\b\7\b\2\2"+
		"\b\t\7\7\2\2\t\21\7\b\2\2\n\13\7\b\2\2\13\f\7\4\2\2\f\21\7\b\2\2\r\16"+
		"\7\b\2\2\16\17\7\5\2\2\17\21\7\b\2\2\20\4\3\2\2\2\20\7\3\2\2\2\20\n\3"+
		"\2\2\2\20\r\3\2\2\2\21\3\3\2\2\2\3\20";
	public static final ATN _ATN =
		new ATNDeserializer().deserialize(_serializedATN.toCharArray());
	static {
		_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
		for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
			_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
		}
	}
}